From d6780cf3dad729c69a102ba2940188cf1e6bcbf4 Mon Sep 17 00:00:00 2001 From: zephex Date: Sat, 20 Apr 2024 13:34:53 +0530 Subject: idk whats happening --- .../manga/[title]/[id]/[read]/currentReading.jsx | 68 +++++------ src/app/manga/[title]/[id]/[read]/download.jsx | 42 +++---- src/app/manga/[title]/[id]/[read]/page.jsx | 112 +++++++++--------- src/app/manga/[title]/[id]/[read]/read.module.css | 128 ++++++++++----------- 4 files changed, 175 insertions(+), 175 deletions(-) (limited to 'src/app/manga/[title]/[id]/[read]') diff --git a/src/app/manga/[title]/[id]/[read]/currentReading.jsx b/src/app/manga/[title]/[id]/[read]/currentReading.jsx index 0050d61..5205ea9 100644 --- a/src/app/manga/[title]/[id]/[read]/currentReading.jsx +++ b/src/app/manga/[title]/[id]/[read]/currentReading.jsx @@ -1,34 +1,34 @@ -"use client"; - -import styles from "./read.module.css"; -import { useEffect } from "react"; - -function get_current_info(title) { - let req = {}; - - useEffect(() => { - const data = JSON.parse(localStorage.getItem("mangaData")); - data.watchHis.forEach((element) => { - if (element.title === title) { - req.chapter = element.chapter; - req.volume = element.volume; - } - }); - }, []); - - return req || false; -} - -export default function Current({ name: title }) { - let data = get_current_info(title); - if (!data) { - return; - } - - return ( -
-

{data.chapter}

-

{data.volume}

-
- ); -} +"use client"; + +import styles from "./read.module.css"; +import { useEffect } from "react"; + +function get_current_info(title) { + let req = {}; + + useEffect(() => { + const data = JSON.parse(localStorage.getItem("mangaData")); + data.watchHis.forEach((element) => { + if (element.title === title) { + req.chapter = element.chapter; + req.volume = element.volume; + } + }); + }, []); + + return req || false; +} + +export default function Current({ name: title }) { + let data = get_current_info(title); + if (!data) { + return; + } + + return ( +
+

{data.chapter}

+

{data.volume}

+
+ ); +} diff --git a/src/app/manga/[title]/[id]/[read]/download.jsx b/src/app/manga/[title]/[id]/[read]/download.jsx index e7a20ee..bddf6d3 100644 --- a/src/app/manga/[title]/[id]/[read]/download.jsx +++ b/src/app/manga/[title]/[id]/[read]/download.jsx @@ -1,21 +1,21 @@ -"use client"; - -import styles from "./read.module.css"; - -export default function DownloadManga({ chapterId: id }) { - return ( -
- - alert( - "Downloads are not instant. It might take some time to prepare your file. Thank you for your patience" - ) - } - > - - -
- ); -} +"use client"; + +import styles from "./read.module.css"; + +export default function DownloadManga({ chapterId: id }) { + return ( +
+ + alert( + "Downloads are not instant. It might take some time to prepare your file. Thank you for your patience" + ) + } + > + + +
+ ); +} diff --git a/src/app/manga/[title]/[id]/[read]/page.jsx b/src/app/manga/[title]/[id]/[read]/page.jsx index dbba6e0..a4181d7 100644 --- a/src/app/manga/[title]/[id]/[read]/page.jsx +++ b/src/app/manga/[title]/[id]/[read]/page.jsx @@ -1,56 +1,56 @@ -import styles from "./read.module.css"; -import Image from "next/image"; -import DownloadManga from "./download"; - -export default async function Read({ params }) { - const chapterId = params.read; - const results = await getPages(chapterId); - const image_base_url = results.baseUrl + "/data/" + results.chapter.hash; - - if (results.length === 0) { - return ( -
-

- This chapter has no content. Please check the next chapter. -

-
- ); - } - - let images = []; - for (var i = 0; i < results.chapter.data.length; i++) { - var imgUrl = image_base_url + "/" + results.chapter.data[i]; - images.push(imgUrl); - } - - return ( -
-
- -

Total pages: {images.length}

- {images && - images.map((item, index) => ( -
- Pages -

{index + 1}

-
- ))} -
-
- ); -} - -async function getPages(id) { - const res = await fetch(`https://api.mangadex.org/at-home/server/${id}`); - const data = await res.json(); - return data; -} +import styles from "./read.module.css"; +import Image from "next/image"; +import DownloadManga from "./download"; + +export default async function Read({ params }) { + const chapterId = params.read; + const results = await getPages(chapterId); + const image_base_url = results.baseUrl + "/data/" + results.chapter.hash; + + if (results.length === 0) { + return ( +
+

+ This chapter has no content. Please check the next chapter. +

+
+ ); + } + + let images = []; + for (var i = 0; i < results.chapter.data.length; i++) { + var imgUrl = image_base_url + "/" + results.chapter.data[i]; + images.push(imgUrl); + } + + return ( +
+
+ +

Total pages: {images.length}

+ {images && + images.map((item, index) => ( +
+ Pages +

{index + 1}

+
+ ))} +
+
+ ); +} + +async function getPages(id) { + const res = await fetch(`https://api.mangadex.org/at-home/server/${id}`); + const data = await res.json(); + return data; +} diff --git a/src/app/manga/[title]/[id]/[read]/read.module.css b/src/app/manga/[title]/[id]/[read]/read.module.css index 420fff8..0133232 100644 --- a/src/app/manga/[title]/[id]/[read]/read.module.css +++ b/src/app/manga/[title]/[id]/[read]/read.module.css @@ -1,65 +1,65 @@ -.Main { - margin: 80px auto; -} - -.Image { - display: flex; - flex-direction: column; - align-items: center; - background-color: #1b1b1b; - border-radius: 10px; - width: 50%; - margin: 10px auto; -} - -.ImageContainer img { - max-width: auto; - height: auto; - border-radius: 5px; - margin-top: 10px; -} - -.ImageContainer p { - text-align: center; - color: white; - font-family: "Atkinson Hyperlegible", serif; - font-size: 16px; - margin: 5px; -} - -.NotFound { - text-align: center; - color: white; - font-family: "Atkinson Hyperlegible", serif; - font-size: 20px; -} - -.DownloadMain { - text-align: center; -} - -.DownloadMain button { - border: none; - outline: none; - border-radius: 5px; - padding: 5px; - font-family: "Atkinson Hyperlegible", serif; - font-size: 16px; - background-color: var(--light-green); - cursor: pointer; -} - -.DownloadMain button:hover { - background-color: var(--pastel-red); -} - -@media screen and (max-width: 768px) { - .ImageContainer img { - width: 95%; - align-items: center; - } - - .Image { - width: 100%; - } +.Main { + margin: 80px auto; +} + +.Image { + display: flex; + flex-direction: column; + align-items: center; + background-color: #1b1b1b; + border-radius: 10px; + width: 50%; + margin: 10px auto; +} + +.ImageContainer img { + max-width: auto; + height: auto; + border-radius: 5px; + margin-top: 10px; +} + +.ImageContainer p { + text-align: center; + color: white; + font-family: "Atkinson Hyperlegible", serif; + font-size: 16px; + margin: 5px; +} + +.NotFound { + text-align: center; + color: white; + font-family: "Atkinson Hyperlegible", serif; + font-size: 20px; +} + +.DownloadMain { + text-align: center; +} + +.DownloadMain button { + border: none; + outline: none; + border-radius: 5px; + padding: 5px; + font-family: "Atkinson Hyperlegible", serif; + font-size: 16px; + background-color: var(--light-green); + cursor: pointer; +} + +.DownloadMain button:hover { + background-color: var(--pastel-red); +} + +@media screen and (max-width: 768px) { + .ImageContainer img { + width: 95%; + align-items: center; + } + + .Image { + width: 100%; + } } \ No newline at end of file -- cgit v1.2.3